1. Field of the Invention
The present invention relates to a data rewriting apparatus for updating the data recording in a nonvolatile memory provided in an apparatus and limited in rewriting, on the basis of an updating program and updating data supplied from a detachable recording medium in the apparatus, and also a control method and a recording medium.
2. Description of the Related Art
In certain microcomputers incorporated in personal digital assistants, at present, a ROM data storage area for storing programs is used as a flash memory, and there is a function of rewriting the program for controlling the apparatus stored in the flash memory or the data necessary when operating the program from outside, for the purpose of adding a function of the apparatus or enhancing the performance, for example, after mounting on the substrate. Usually, in such microcomputers, the serial interface to be provided as part of the function or the serial communication interface for realizing rewriting from outside of the apparatus is provided in the apparatus, and it is designed to write the ROM data from an external writing device by using serial communication.
Generally, rewriting operation of ROM data for such function addition or function enhancement is a very dangerous task that determines the operation of the apparatus, and it is designed not to get into a writing state easily by mistake. Therefore, conventionally, when rewriting the ROM data, for example, at a service center or a repair shop, by opening the cover of the apparatus to be accessible to the inside parts, a hard wiring such as jumper wire for transmitting a control signal necessary for getting into rewriting operation is soldered, or physical operation is required such as changeover of wiring or changeover of switch, so that the program for rewriting the ROM data stored in the apparatus may not be put into the ROM data rewriting operation by mistake by the user or other accident.
In a car navigation system, a CD-ROM for rewriting ROM data or the like is loaded in the navigation system, and the ROM data is rewritten by a program loader provided in the navigation system having a stable power source, so that a new function is added or navigation data is updated.
Further, in an Internet router, to use a new Internet protocol or network application program, for example, or to add newly a program for protecting the LAN (local area network) from cracking, by a program for downloading a file for updating provided in the router, a ROM data rewriting file is supplied from the server into the router, and the ROM data is similarly rewritten by the program loader provided in the router having a stable power source.
Lately, by forming a small storage medium having a solid memory element such as flash memory, it is proposed to store computer data, video data and audio data by using an exclusive drive device or incorporating a drive device in an audio and video appliance or information device.
However, such ROM data rewriting operation requires changeover of electric circuit of the apparatus in order to avoid rewriting of ROM data by mistake, and if the apparatus is disassembled by the service engineering or service provider, or the program is rewritten by the user, it is necessary to prepare special tools and connect to the specified external terminal of the apparatus, which was very inconvenient.
Or, in the personal digital assistant in which the power source is not stable, the operation of the microcomputer may become unstable due to sudden fluctuations or a drop of the supply voltage, or, in a worst case, the program for rewriting the ROM data may be put into operation by runaway, and therefore the program loader for rewriting the ROM data cannot be provided in the apparatus, which was also inconvenient.
In the storage system using such solid memory element, it is demanded to process the stored file efficiently. For example, it is required that the data moving, duplication and rewriting necessary for file processing in the storage medium should be a minimum limit, or that the processing time and power consumption should be a minimum limit.
By contrast, in the development environment of many programs such as ROM data mentioned above, since the FAT (file allocation table) is used as the file system, it is convenient for copying the ROM data if the ROM data is described as a file system such as FAT in the case of writing ROM data into the microcomputer through a recording medium. In this case, however, it is required on the apparatus side to interpret the file system of a relatively large scale such as FAT, and hence processing of recorded data is very complicated.
More specifically, between a physical address for using the physical access to the flash memory, and a logical address for processing the data in the logic space by using the FAT, the address converting operation is required in the memory access driver unit in the apparatus, by using a logic-physical address conversion table for converting, for example, between the logical address handled in the logic space provided on the flash memory and the physical address used when actually accessing the flash memory. Further, on the preliminary condition of the physical specification that the erasing unit of flash memory is greater than the writing unit. In the FAT, moreover, since the data is accessed by using the recording capable of overwriting the data, when using the flash memory required to writer after erasing, the erasing process and writing process on the flash memory must be also done in the memory access driver when a writing request is made in the FAT.
When using the FAT as the file system, usually, the process of opening the file and writing the data is needed when writing the data, but as the internal processing in the apparatus at this time, it requires block swapping process of changing or partly erasing the data to be done by changing the logical address to the logical address before change by writing the changed data into the block of the specified physical address already erased in the erasing unit of the flash memory, and also the process of converting the logical address used by the FAT file system and the physical address which is the physical allocation sequence of the flash memory by means of the conversion table, and such complicated process took much time and labor.